/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author jy
 */
import javax.swing.*;
import java.awt.*;
import java.net.*;

public class StartUI extends JWindow implements Runnable{
    Thread splashThread;
    //JProgressBar jpb;
    
    public StartUI()
    {
        Container container = getContentPane();
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//        URL url = getClass().getResource("images/start2.jpg");
//        if(url != null)
        
            System.out.println("you");
            container.add( new JLabel(new ImageIcon("images/start4.jpg")), BorderLayout.CENTER);
        
        
//        jpb = new JProgressBar;
//        jpb.setStringPainted(true);
//        jpb.setString("程序加载中，请稍后.....");
//        jpb.setBackground(Color.WHITE);
//        container.add(jpb, BorderLayout.SOUTH);
        
        Dimension screen = getToolkit().getScreenSize();
        pack();
        setLocation((screen.width-getSize().width)/2, (screen.height-getSize().height)/2);
        
    }
    
    public void start()
    {
        this.toFront();
        splashThread = new Thread(this);
        splashThread.start();
        
    }
    
    
    @Override
    public void run()
    {
        setVisible(true);
        //加载
        Dic.initFrequentDic();
        Dic.initWordDic();
        dispose();
        showFrame();
    }
    
    public static void showFrame()
    {
        NLPUI frame = new NLPUI();
        frame.setVisible(true);
    }
}
